package com.toby.ioc.lifecycle;

import org.springframework.context.SmartLifecycle;
import org.springframework.stereotype.Component;

/**
 * @desc: 每个对象都有自己生命周期的需求，比如eruaka启动的入口就是用这个实现的
 * @author: toby
 * @date: 2019/7/13 2:00
 */
@Component
public class TobyLifecycle implements SmartLifecycle {
    @Override
    public boolean isAutoStartup() {
        return true;
    }

    @Override
    public void stop(Runnable callback) {

    }

    @Override
    public void start() {
        System.out.println("TobyLifecycle start");
    }

    @Override
    public void stop() {

    }

    @Override
    public boolean isRunning() {
        return false;
    }

    @Override
    public int getPhase() {
        return 0;
    }
}
